home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / disk / cdrom / SkandalfoCDP.lha / SCDPlayer / Sources / scdp.h < prev    next >
C/C++ Source or Header  |  1996-09-01  |  7KB  |  283 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <stdlib.h>
  6. #include <dos.h>
  7. #include <dos/dos.h>
  8. #include <graphics/gfxmacros.h>
  9. #include <exec/types.h>
  10. #include <exec/io.h>
  11. #include <exec/execbase.h>
  12. #include <exec/nodes.h>
  13. #include <exec/memory.h>
  14. #include <exec/libraries.h>
  15. #include <workbench/workbench.h>
  16. #include <workbench/startup.h>
  17. #include <devices/trackdisk.h>
  18. #include <devices/scsidisk.h>
  19. #include <devices/timer.h>
  20. #include <devices/inputevent.h>
  21. #include <libraries/dos.h>
  22. #include <libraries/mui.h>
  23. #include <libraries/diskfont.h>
  24. #include <clib/diskfont_protos.h>
  25. #include <clib/alib_protos.h>
  26. #include <clib/asl_protos.h>
  27. #include <clib/muimaster_protos.h>
  28. #include <clib/exec_protos.h>
  29. #include <clib/dos_protos.h>
  30. #include <clib/utility_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/graphics_protos.h>
  33. #include <clib/icon_protos.h>
  34. #include <clib/commodities_protos.h>
  35. #include <clib/wb_protos.h>
  36. #include <clib/intuition_protos.h>
  37. #include <clib/locale_protos.h>
  38. #include <intuition/intuition.h>
  39. #include <intuition/gadgetclass.h>
  40. #include <graphics/displayinfo.h>
  41. #include <pragmas/diskfont_pragmas.h>
  42. #include <pragmas/exec_sysbase_pragmas.h>
  43. #include <pragmas/dos_pragmas.h>
  44. #include <pragmas/icon_pragmas.h>
  45. #include <pragmas/graphics_pragmas.h>
  46. #include <pragmas/intuition_pragmas.h>
  47. #include <pragmas/gadtools_pragmas.h>
  48. #include <pragmas/utility_pragmas.h>
  49. #include <pragmas/asl_pragmas.h>
  50. #include <pragmas/muimaster_pragmas.h>
  51. #include <pragmas/locale_pragmas.h>
  52.  
  53. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase,*DiskfontBase;
  54. struct Library *MUIMasterBase, *LocaleBase;
  55. struct Catalog *catalog;
  56.  
  57. #define VERSION "1.6"
  58.  
  59. #include "scdplocale.h"
  60.  
  61. #define STACKSIZE 16384
  62.  
  63. #define REG(x) register __ ## x
  64. #define ASM    __asm
  65. #define SAVEDS __saveds
  66.  
  67. /* For the fonts */
  68. struct TextFont *normalfont=NULL;
  69. struct TextFont *tinyfont=NULL;
  70. struct TextFont *fixedfont=NULL;
  71. struct TextFont *listfont=NULL;
  72. struct TextFont *titlefont=NULL;
  73. BOOL customfonts=FALSE;
  74. char *normalname="topaz/8";
  75. char *tinyname="topaz/8";
  76. char *fixedname="topaz/8";
  77. char *listname="topaz/8";
  78. char *titlename="topaz/8";
  79. /* For disks path */
  80. char diskspath[513]="PROGDIR:disks";
  81.  
  82. struct MUI_CustomClass *CL_ProgramList=NULL;
  83.  
  84. /*************************/
  85. /* Init & Fail Functions */
  86. /*************************/
  87.  
  88. static VOID fail(APTR app,char *str)
  89. {
  90.         if (app)
  91.                 MUI_DisposeObject(app);
  92.  
  93. #ifndef _DCC
  94.         if (MUIMasterBase)
  95.                 CloseLibrary(MUIMasterBase);
  96. #endif
  97.         if (LocaleBase)
  98.         {
  99.             CloseLibrary(LocaleBase);
  100.             if(catalog)
  101.                 CloseCatalog(catalog);
  102.         }
  103.  
  104.         if(normalfont)
  105.             CloseFont(normalfont);
  106.         if(tinyfont)
  107.             CloseFont(tinyfont);
  108.         if(fixedfont)
  109.             CloseFont(fixedfont);
  110.         if(listfont)
  111.             CloseFont(listfont);
  112.         if(titlefont)
  113.             CloseFont(titlefont);
  114.  
  115.         if(CL_ProgramList)
  116.             MUI_DeleteCustomClass(CL_ProgramList);
  117.  
  118.         if (str)
  119.         {
  120.                 puts(str);
  121.                 exit(20);
  122.         }
  123.         exit(0);
  124. }
  125.  
  126.  
  127. #ifdef _DCC
  128.  
  129. int brkfunc(void) { return(0); }
  130.  
  131. int wbmain(struct WBStartup *wb_startup)
  132. {
  133.         extern int main(int argc, char *argv[]);
  134.         return (main(0, (char **)wb_startup));
  135. }
  136.  
  137. #endif
  138.  
  139.  
  140. #ifdef __SASC
  141. int CXBRK(void) { return(0); }
  142. int _CXBRK(void) { return(0); }
  143. void chkabort(void) {}
  144. #endif
  145.  
  146.  
  147. static VOID init(VOID)
  148. {
  149. #ifdef _DCC
  150.         onbreak(brkfunc);
  151. #endif
  152.  
  153. #ifndef _DCC
  154.         if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  155.                 fail(NULL,glstr(MSG_FailMUI));
  156. #endif
  157.         if(LocaleBase = OpenLibrary("locale.library",38))
  158.         {
  159.             catalog=OpenCatalog(NULL,"scdp.catalog",NULL);
  160.         }
  161. }
  162.  
  163.  
  164. #ifndef MAKE_ID
  165. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  166. #endif
  167.  
  168.  
  169. #define BYTES_PER_LINE  16
  170. #define SENSE_LEN 252
  171. #define MAX_DATA_LEN 252
  172. #define MAX_TOC_LEN 804         /* max TOC size = 100 TOC track descriptors */
  173. #define PAD 0
  174. #define LINE_BUF        (128)
  175. #define NUM_OF_CDDAFRAMES 75    /* 75 frames per second audio */
  176. #define CDDALEN 2448            /* 1 frame has max. 2448 bytes (subcode 2) */
  177.  
  178. #define OFFS_KEY 2
  179. #define OFFS_CODE 12
  180.  
  181. typedef struct MsgPort MSGPORT;
  182. typedef struct IOStdReq IOSTDREQ;
  183. typedef struct List LIST;
  184. typedef struct Node NODE;
  185. typedef struct SCSICmd SCSICMD;
  186.  
  187. typedef struct
  188.  {
  189.    BYTE   code;
  190.    UBYTE  *ptr;
  191.  } IDTOSTRING;
  192.  
  193. typedef struct
  194.  {
  195.    UBYTE  opcode;
  196.    UBYTE  b1;
  197.    UBYTE  b2;
  198.    UBYTE  b3;
  199.    UBYTE  b4;
  200.    UBYTE  control;
  201.  } SCSICMD6;
  202.  
  203. typedef struct
  204.  {
  205.    UBYTE  opcode;
  206.    UBYTE  b1;
  207.    UBYTE  b2;
  208.    UBYTE  b3;
  209.    UBYTE  b4;
  210.    UBYTE  b5;
  211.    UBYTE  b6;
  212.    UBYTE  b7;
  213.    UBYTE  b8;
  214.    UBYTE  control;
  215.  } SCSICMD10;
  216.  
  217. typedef struct
  218.  {
  219.    UBYTE  opcode;
  220.    UBYTE  b1;
  221.    UBYTE  b2;
  222.    UBYTE  b3;
  223.    UBYTE  b4;
  224.    UBYTE  b5;
  225.    UBYTE  b6;
  226.    UBYTE  b7;
  227.    UBYTE  b8;
  228.    UBYTE  b9;
  229.    UBYTE  b10;
  230.    UBYTE  control;
  231.  } SCSICMD12;
  232.  
  233. #define SCSI_CMD_TUR    0x00
  234. #define SCSI_CMD_RZU    0x01
  235. #define SCSI_CMD_RQS    0x03
  236. #define SCSI_CMD_FMU    0x04
  237. #define SCSI_CMD_RAB    0x07
  238. #define SCSI_CMD_RD     0x08
  239. #define SCSI_CMD_WR     0x0A
  240. #define SCSI_CMD_SK     0x0B
  241. #define SCSI_CMD_INQ    0x12
  242. #define SCSI_CMD_MSL    0x15
  243. #define SCSI_CMD_RU     0x16
  244. #define SCSI_CMD_RLU    0x17
  245. #define SCSI_CMD_MSE    0x1A
  246. #define SCSI_CMD_SSU    0x1B
  247. #define SCSI_CMD_RDI    0x1C
  248. #define SCSI_CMD_SDI    0x1D
  249. #define SCSI_CMD_PAMR   0x1E
  250. #define SCSI_CMD_RCP    0x25
  251. #define SCSI_CMD_RXT    0x28
  252. #define SCSI_CMD_WXT    0x2A
  253. #define SCSI_CMD_SKX    0x2B
  254. #define SCSI_CMD_WVF    0x2E
  255. #define SCSI_CMD_VF     0x2F
  256. #define SCSI_CMD_RDD    0x37
  257. #define SCSI_CMD_WDB    0x3B
  258. #define SCSI_CMD_RDB    0x3C
  259.  
  260. #define SCSI_CMD_COPY           0x18
  261. #define SCSI_CMD_COMPARE        0x39
  262. #define SCSI_CMD_COPYANDVERIFY  0x3A
  263. #define SCSI_CMD_CHGEDEF        0x40
  264. #define SCSI_CMD_READSUBCHANNEL 0x42
  265. #define SCSI_CMD_READTOC        0x43
  266. #define SCSI_CMD_READHEADER     0x44
  267. #define SCSI_CMD_PLAYAUDIO12    0xA5
  268. #define SCSI_CMD_PLAYAUDIOTRACKINDEX    0x48
  269. #define SCSI_CMD_PAUSERESUME    0x4B
  270.  
  271. #define CheckMarkH(selected,help)\
  272.         ImageObject,\
  273.                 ImageButtonFrame,\
  274.                 MUIA_InputMode        , MUIV_InputMode_Toggle,\
  275.                 MUIA_Image_Spec       , MUII_CheckMark,\
  276.                 MUIA_Image_FreeVert   , TRUE,\
  277.                 MUIA_Selected         , selected,\
  278.                 MUIA_Background       , MUII_ButtonBack,\
  279.                 MUIA_ShowSelState     , FALSE,\
  280.                 MUIA_ShortHelp        , help,\
  281.                 End
  282.  
  283.